<!-- 投诉管理 -->
<template>
	<view>
		<u-navbar :isFixed="true" title="在线客服" :borderBottom="false"></u-navbar>
		<scroll-view scroll-y="true" class="chatlist">
			<view @click="chat(item)" class="chatOne" v-for="(item,index) in list" :key="index">
				<image :src="item.image" mode="aspectFill"></image>
				<view class="chatInfo">
					<view class="chatInfo_nt">
						<text class="chatname">{{item.username}}</text>
						<text class="chattime">{{item.sex}}</text>
					</view>
					<view class="chatInfo_contents">
						<text>{{item.mobile}}</text>
						<!-- <view class="chatags" >...</view> -->
					</view>
				</view>
			</view>

		</scroll-view>
	</view>
</template>

<script>
	var _this, $paginator;
	export default {
		data() {
			return {
				list: [],
				from_id: wx.getStorageSync('client_uid'),
			}
		},
		onLoad(options) {
			_this = this
			// $paginator = new _this.$paginator(_this.$api)
			_this.getdata()
		},
		// onReachBottom: function() {
		// 	$paginator.nextPager(() => {
		// 		_this.getdata()
		// 	})
		// },
		methods: {
			// getdata: function(firstLoad = false) {
			// 	$paginator.getData('getcomplaint', {}, (data) => {
			// 		if (firstLoad) {
			// 			_this.list = data.list ? data.list : []
			// 		} else {
			// 			_this.list = _this.list.concat(data.list)
			// 		}
			// 		_this.nomore = data.nomore
			// 	})
			// },

			getdata() {
				_this.$api.get("kefulist", {
					page: 1
				}).then(data => {
					_this.list = data
					console.log(data, '1')

				});
			},
			// 跳转到聊天
			chat(obj) {
				wx.closeSocket();
				let list = {}
				list = {
					to_id: obj.member_id,
					from_id: _this.from_id,
					name: obj.username,
				}

				wx.setStorageSync('list', list)
				uni.navigateTo({
					url: '../chat/chatingroom?type=2' + '&member_type=2'
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	page {
		background: #F3F3F3;
	}

	.chatlist {
		flex: 1;
		display: flex;

		.chatOne {
			display: flex;
			flex-direction: row;
			align-items: center;
			padding: 0 35rpx;

			image {
				width: 94rpx;
				height: 94rpx;
				border-radius: 50%;
			}

			.chatInfo {
				margin-left: 29rpx;
				flex: 1;
				border-bottom: 2rpx solid #f2f2f2;
				display: flex;
				flex-direction: column;
				padding: 35rpx 0;

				.chatInfo_nt {
					display: flex;
					flex-direction: row;
					justify-content: space-between;

					.chatname {
						color: #333333;
						font-size: 32rpx;
					}

					.chattime {
						color: #B6B6B6;
						font-size: 24rpx;
					}
				}

				.chatInfo_contents {
					display: flex;
					flex-direction: row;
					align-items: center;
					margin-top: 15rpx;
					justify-content: space-between;

					.chattext {
						max-width: 430rpx;
						color: #B6B6B6;
						font-size: 26rpx;
					}

					.chatags {
						width: 30rpx;
						height: 30rpx;
						border-radius: 50%;
						background-color: #FA3931;
						color: #fff;
						font-size: 24rpx;
						text-align: center;
						line-height: 18rpx;

					}
				}
			}
		}
	}
</style>
